<?php

/**
 * Controlador de test para probar el controlador de servicio.
 * Los parametros se le han de pasar por GET
 * No se ha documentado por ser únicament util a nivel interno.
 *
 * @author Israel Mora e Ismael Garcia
 */

include_once (realpath(dirname(__FILE__)) . '/../controladores/controlDocumentacion.class.php');

$_control = new control_test();

class control_test {

    private $_ctrl;

    public function __construct($capa = 'principal') {
        $action = isset($_GET["action"]) ? $_GET["action"] : 'list';
        $this->_ctrl = new controlDocumentacion();
        switch ($action) {
            case 'new' : $this->newTest();                  break;
            case 'listlabel' : $this->listByLabel();        break;
            case 'subs' : $this->subs();                    break;
        }
    }

    public function newTest() {
        $data["nom"] = 1;
        $data["direc"] = 2;

        $this->_ctrl->editTemplate(1,$data);
    }

    public function listByLabel() {
        $capa = "principal";
        $new = 'controladores/control_template.class.php?action=new';
        $show = 'controladores/control_template.class.php?action=show';
        $edit = 'controladores/control_template.class.php?action=edit';
        $delete = 'controladores/control_template.class.php?action=delete';
        $download = 'controladores/control_template.class.php?action=download';
        $asign = 'controladores/control_asign_templ.class.php?action=list';
        $new = null;
        $files = $this->_ctrl->getTemplateListByLabel(2);
        include '../vistas/template_manager.php';
    }
    
    public function subs(){
        
        $data[0]["dir"] = 'dark';
        $data[1]["dir"] = 'light';
        $data[0]["nom"] = 'israel';
        $data[0]["casa"] = 'lejos';
        $data[1]["nom"] = 'ana';
        $subs = $this->_ctrl->getMultiTemplateText(2, $data);
        print_r($subs);
    }

}

?>
